<template>
  <section class="art_info">
    <!-- <h2 class="title">标题：{{artinfo.title}}  </h2> -->
    <div class="tag">
      <p>{{artinfo.tag}}</p>
      <!-- <span @click="editArt">修改文章</span> -->
      <nuxt-link :to="{name:'articles-ArtEdit', params:{artinfo: this.artinfo}}">修改文章</nuxt-link>
    </div>
    <p>发表时间：{{artinfo.time}}</p>
    <div class="art_context" v-html="artinfo.content"></div>
  </section>
</template>

<script>
import { async } from 'q';
export default {
  async asyncData({$axios,params}){
    let result = await $axios.$get('/art/search',{params:{id:params.id}})
    return { artinfo: result.msg[0] }
  },
  data(){
    return{

    }
  },
  created(){

  },
  methods:{
    editArt(){
      this.$router.push({name:'articles-ArtEdit', params:{artinfo: this.artinfo}} )
    }
  }
}
</script>

<style lang="scss" scoped>
  .art_info{
    .tag{
      display: flex;
      justify-content: space-around;
      p{
        padding: 5px;
        background-color: blue;
        color: #fff;
        width: 84px;
        line-height: 34px;
        border-radius: 10px;
        text-align: center;
      }
      span{
        width: 84px;
        text-align: center;
        line-height: 33px;
        background-color: blue;
        color: #fff;
        border-radius: 10px;
        padding: 5px;

      }
    }
  }
</style>